home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1994 #2 / Monster Media No. 2 (Monster Media)(1994).ISO / utils2 / pwrbat22.zip / PB20DEMO.PWR < prev    next >
Text File  |  1994-05-18  |  17KB  |  443 lines

  1. Variable        Fore,1                 ;save areas for initial colors
  2. Variable        Back,1
  3. Variable        ColorAttr,3
  4. Variable        Prn,3
  5. Variable        CharIn,1             ;for user responses
  6. Variable        FnKey,1
  7. Variable        RedOnGray,3,116
  8. Variable        RedOnBlack,3,4
  9. Variable        YelOnBlue,3,30
  10. Variable        YelOnGray,3,126
  11. Variable        BlueOnGray,3,113
  12. Variable        F1,1,#59            ;key value for F1
  13. Variable        ID,4
  14. Variable        MainTitle,36,'126PowerBatch 116Functions'
  15. Variable        M1L1,34,'116Get 126S116ystem Information'
  16. Variable        M1L2,22,'116Draw 126B116oxes'
  17. Variable        M1L3,35,'116Get Input From 126K116eyboard'
  18. Variable        M1L4,28,'116St126R116ing Functions'
  19. Variable        M1L5,25,'116Screen 126W116rites'
  20. Variable        M1L6,21,'126M116iscellaneous'
  21. Variable        M2L1,25,'116Current 126C116olor'
  22. Variable        M2L2,29,'116Current 126D116irectory'
  23. Variable        M2L3,24,'116Current Da126T116e'
  24. Variable        M2L4,21,'116Disk126S116pace'
  25. Variable        M2L5,29,'126E116nvironment Variables'
  26. Variable        M2L6,24,'116Current Ti126M116e'
  27. Variable        Msg,78
  28. Variable        EscMsg,13,' Esc To Quit '
  29. Variable        ContMsg,25,'Press Any Key To Continue'
  30. Variable        ColorMsg1,78,'PowerBatch will supply you with the current foreground, background, and'
  31. Variable        ColorMsg2,78,'composite color by issuing the command ?COLOR. This message is displayed'
  32. Variable        ColorMsg3,78,'using the color attributes active when DEMO2 was started.'
  33. Variable        DOW,9                ;for date command
  34. Variable        Mo,2
  35. Variable        Da,2
  36. Variable        Yr,4
  37. Variable        CurrTime,11          ;for current time
  38. Variable        DriveLtr,1
  39. Variable        DirName,78           ;for user entered directory name
  40. Variable        FileName,78          ;for user entered file name
  41. Variable        Space35,35,"                                   "
  42. Variable        Space76,76,"                                                                            "
  43. Variable        TotSpace,10
  44. Variable        AvailSpace,10
  45. Variable        Msg2,78
  46. Variable        FName,35
  47. Variable        LName,35
  48. ?Color          Fore,Back,ColorAttr  ;initial color
  49. ?Date           DOW,Mo,Da,Yr         ;get system date
  50. ?Time           CurrTime             ;get system time
  51. Cursor            2
  52. Clear
  53. SetVar            CharIn,DispAdapter
  54. Compare         CharIn,"C",,,ColorMon
  55. WriteLine        'This demo is designed to run on a color monitor'
  56. Halt
  57. Label           ColorMon
  58. Clear            YelOnGray            ;clear to my color
  59. Box4            25,2,51,16,116
  60. WriteAt         28,2,MainTitle
  61. WriteAt         27,4,M1L1
  62. WriteAt         27,6,M1L2
  63. WriteAt         27,8,M1L3
  64. WriteAt         27,10,M1L4
  65. WriteAt         27,12,M1L5
  66. WriteAt         27,14,M1L6
  67. WriteAt         33,16,EscMsg
  68. Label            GetM1
  69. GoToXY            39,15
  70. Write            ' '
  71. GoToXY            39,15
  72. ReadUpKey        CharIn
  73. Compare         CharIn,'',,,Finis
  74. Compare         CharIn,'S',,,SysInfo
  75. Compare         CharIn,'B',,,BoxInfo
  76. Compare         CharIn,'K',,,KeyBdInfo
  77. Compare         CharIn,'R',,,StrInfo
  78. Compare         CharIn,'W',,,WritInfo
  79. Compare         CharIn,'M',,,MiscInfo
  80. Beep            800,1
  81. Beep            300,2
  82. GoTo            GetM1
  83. Label        SysInfo
  84. Box4            40,4,64,18,116
  85. Color            RedOnGray
  86. WriteAt         43,4,'System Information'
  87. WriteAt         42,6,M2L1
  88. WriteAt         42,8,M2L2
  89. WriteAt         42,10,M2L3
  90. WriteAt         42,12,M2L4
  91. WriteAt         42,14,M2L5
  92. WriteAt         42,16,M2L6
  93. WriteAt         48,18,EscMsg
  94. Label        GetM2
  95. GoToXY            52,17
  96. Write            ' '
  97. GoToXy            52,17
  98. ReadUpKey        CharIn
  99. Compare         CharIn,'',,,ColorMon
  100. Compare         CharIn,'C',,,ColorInfo
  101. Compare         CharIn,'D',,,DirInfo
  102. Compare         CharIn,'T',,,DateInfo
  103. Compare         CharIn,'S',,,SpaceInfo
  104. Compare         CharIn,'E',,,EnvirInfo
  105. Compare         CharIn,'M',,,TimeInfo
  106. Beep            800,1
  107. Beep            300,2
  108. GoTo            GetM2
  109. Label       ColorInfo
  110. WriteAt         2,20,ColorMsg1,ColorAttr
  111. WriteAt         2,21,ColorMsg2,ColorAttr
  112. WriteAt         2,22,ColorMsg3,ColorAttr
  113. GoTo        M2Cont
  114. Label        DirInfo
  115. SetVar            DriveLtr,'A'
  116. ?CurrDir        DriveLtr,DirName
  117. Concat            Msg,'Drive A current directory is ',DirName
  118. WriteAt         2,20,Msg
  119. Label        DrC
  120. SetVar            DriveLtr,'C'
  121. ?DriveExist     DriveLtr,DrCOK
  122. WriteAt         2,21,'No drive C defined in your system.'
  123. GoTo            M2Cont
  124. Label        DrCOK
  125. ?CurrDir        DriveLtr,DirName
  126. Concat            Msg,'Drive C current directory is ',DirName
  127. WriteAt         2,21,Msg
  128. SetVar            DriveLtr,'D'
  129. ?DriveExist     DriveLtr,DrDOK
  130. WriteAt         2,22,'No drive D defined in your system.'
  131. GoTo            M2Cont
  132. Label        DrDOK
  133. ?CurrDir        DriveLtr,DirName
  134. Concat            Msg,'Drive D current directory is ',DirName
  135. WriteAt         2,22,Msg
  136. GoTo            M2Cont
  137. Label        DateInfo
  138. Concat            Msg,'Today is ',DOW
  139. Concat            Msg,' '
  140. Concat            Msg,Mo
  141. Concat            Msg,'/'
  142. Concat            Msg,Da
  143. Concat            Msg,'/'
  144. Concat            Msg,Yr
  145. WriteAt         2,20,Msg
  146. GoTo            M2Cont
  147. Label        SpaceInfo
  148. WriteAt         2,20,'Enter drive letter '
  149. ReadUpKey        DriveLtr
  150. ?DriveExist     DriveLtr,ValidDr
  151. WriteAt         2,20,'Invalid Drive !!!  '
  152. GoTo            GetM2
  153. Label            ValidDr
  154. ?DiskSpace        DriveLtr,TotSpace,AvailSpace
  155. Compare         TotSpace,0,,DrNotRdy,DrNotRdy
  156. Concat            Msg,'Drive ',DriveLtr
  157. Concat            Msg,' has a capacity of '
  158. Concat            Msg,TotSpace
  159. Concat            Msg,' bytes. The disk has '
  160. Concat            Msg,AvailSpace
  161. Concat            Msg,' bytes free.'
  162. WriteAt         2,20,Msg
  163. GoTo            M2Cont
  164. Label        DrNotRdy
  165. WriteAt         2,20,'Drive not ready !!!'
  166. GoTo            M2Cont
  167. Label        EnvirInfo
  168. ?EnvStr         'PATH',DirName
  169. Concat            Msg,'Current path is ',DirName
  170. WriteAt         2,20,Msg
  171. ?EnvStr         'PROMPT',DirName
  172. Concat            Msg,'Your prompt command is ',DirName
  173. WriteAt         2,21,Msg
  174. ?EnvStr         'COMSPEC',DirName
  175. Concat            Msg,'Your command processor is ',DirName
  176. WriteAt         2,22,Msg
  177. GoTo            M2Cont
  178. Label        TimeInfo
  179. WriteAt         27,23,ContMsg,RedOnGray
  180. Label        UpdtTime
  181. ?Time           CurrTime
  182. Concat            Msg,'Your system time is currently ',CurrTime
  183. WriteAt         2,20,Msg
  184. ReadKey         CharIn,,1
  185. Compare         CharIn,'',,,UpdtTime
  186. ClearBox        1,19,78,24,YelOnGray
  187. GoTo            GetM2
  188. Label        M2Cont
  189. WriteAt         27,23,ContMsg,RedOnGray
  190. ReadKey         CharIn
  191. ClearLine        20,RedOnGray
  192. ClearLine        21,RedOnGray
  193. ClearLine        22,RedOnGray
  194. GoTo            GetM2
  195. Label       BoxInfo
  196. Clear
  197. Box1            10,2,55,15,116
  198. WriteAt         12,4,'PowerBatch draws four types of boxes...'
  199. WriteAt         14,6,'A single line border'
  200. Wait            50
  201. Box2            10,2,55,15,116
  202. WriteAt         12,4,'PowerBatch draws four types of boxes...'
  203. WriteAt         14,6,'A double line border'
  204. Wait            30
  205. Box3            10,2,55,15,116
  206. WriteAt         12,4,'PowerBatch draws four types of boxes...'
  207. WriteAt         14,6,'A solid line border'
  208. Wait            30
  209. Box4            10,2,55,15,116,,15
  210. WriteAt         12,4,'PowerBatch draws four types of boxes...'
  211. WriteAt         14,6,'A single line border with a shadow'
  212. Wait            30
  213. WriteAt         14,8,'You can clear the contents of a box'
  214. WriteAt         14,9,'without redrawing the box or clearing'
  215. WriteAt         14,10,'the screen...'
  216. Wait            50
  217. ClearBox        10,2,55,15,116
  218. WriteAt         12,4,'Boxes can be drawn so quickly they can'
  219. WriteAt         12,5,'be made to appear to move.'
  220. Wait            50
  221. ClearBox        9,1,58,16,116
  222. Box1            11,3,56,16,116
  223. ClearBox        10,2,57,17,116
  224. Box1            12,4,57,17,116
  225. ClearBox        11,3,58,18,116
  226. Box1            13,5,58,18,116
  227. ClearBox        12,4,59,19,116
  228. Box1            14,6,59,19,116
  229. ClearBox        13,5,60,20,116
  230. Box1            15,7,60,20,116
  231. ClearBox        14,6,61,21,116
  232. Box1            16,8,61,21,116
  233. ClearBox        15,7,62,22,116
  234. Box4            17,9,62,22,116,,15
  235. WriteAt         19,11,'Boxes can be drawn so quickly they can'
  236. WriteAt         19,12,'be made to appear to move.'
  237. Wait            50
  238. GoTo            ColorMon
  239. Label       KeyBdInfo
  240. Clear
  241. Box1        5,5,75,19,116
  242. WriteAt     7,7,'There are several keyboard read functions in PowerBatch.'
  243. WriteAt     7,8,'You can read a single character (and only one character) from the'
  244. WriteAt     7,9,'keyboard, including all special characters like Alt-F1; you can'
  245. WriteAt     7,10,'read a string of a specified length and not accept any additional'
  246. WriteAt     7,11,'characters; you can read a single key and change the character'
  247. WriteAt     7,12,'to upper case regardless of the case entered; and you can read'
  248. WriteAt     7,13,'a key in response to a (Y)es or (N)o question, forcing the key'
  249. WriteAt     7,14,'to upper case Y or N, and accepting no other characters.'
  250. WriteAt     7,16,'For Example...'
  251. Label        ForceF1
  252. WriteAt     14,17,'Press F1 for Help '
  253. ReadKey     CharIn,FnKey
  254. Compare     FnKey,1,,,SpecKey
  255. Beep        500,3
  256. GoTo        ForceF1
  257. Label        SpecKey
  258. Compare     CharIn,F1,,,GotF1
  259. Beep        500,3
  260. GoTo        ForceF1
  261. Label        GotF1
  262. WriteAt     14,17,'Help is on the way...'
  263. Wait        30
  264. WriteAt     14,17,'Enter Your 4 Digit ID Number And Press Enter '
  265. ReadStr     ID
  266. Wait        20
  267. MidString    Msg,Space76,1,50
  268. WriteAt     14,17,Msg
  269. WriteAt     14,17,'Enter The Drive Letter To Check '
  270. ReadUpKey    CharIn
  271. Wait        20
  272. GoToXY        14,17
  273. ReadYN        'Do you wish to continue with this demo (Y/N) ',CharIn
  274. Wait        30
  275. GoTo        ColorMon
  276. Label        StrInfo
  277. Clear
  278. Box2        1,1,80,11,116            ;for variables
  279. Box1        1,12,39,24,116            ;for compare
  280. Box1        41,12,80,24,116         ;for midstring
  281. Center      ' Variable ',1
  282. WriteAt     15,12,' Compare '
  283. WriteAt     54,12,' MidString '
  284. WriteAt     2,2,'The VARIABLE command is one of the commands which makes PowerBatch unique'
  285. WriteAt     2,3,'among its competitors. You can define variables and constants, give them'
  286. WriteAt     2,4,'an english name, change them, write them, use them as commands, add and'
  287. WriteAt     2,5,'subtract to them, and even use them as parms in a DOS command! There is no'
  288. WriteAt     2,6,'limit to them and they are static, not gradually eating away at your memory.'
  289. WriteAt     2,7,'They are resolved to address locations at compile time and are smart enough'
  290. WriteAt     2,8,'to know if they should be treated as alpha or numeric. You can imbed color'
  291. WriteAt     2,9,'commands in the text definition and give them values you cannot even find a'
  292. WriteAt     2,10,'key for on your keyboard. You can do almost anything to them but abuse them.'
  293.                 ;         1      1    2    2     3      3    4    4     5      5    6    6     7      7    8
  294.                 ;...5....0....5....0....5....0....5....0....5....0....5....0....5....0....5....0
  295. WriteAt     2,14,'The Compare command allows you to'
  296. WriteAt     2,15,'compare two variables, or a variable'
  297. WriteAt     2,16,'and a constant and execute various'
  298. WriteAt     2,17,'parts of your batch program based on'
  299. WriteAt     2,18,'the results. Compare will properly'
  300. WriteAt     2,19,'evaluate 2 compared to 19 (DOS will'
  301. WriteAt     2,20,'not) shifting between numeric and'
  302. WriteAt     2,21,'alphabetic comparisions based on the'
  303. WriteAt     2,22,'contents of the variables being'
  304. WriteAt     2,23,'compared.'
  305. WriteAt     43,14,'The MidString command allows you to'
  306. WriteAt     43,15,'separate variables into smaller'
  307. WriteAt     43,16,'parts as needed. If you enter a'
  308. WriteAt     43,17,'date from the keyboard as mm/dd/yy'
  309. WriteAt     43,18,'you can break it apart into the 3'
  310. WriteAt     43,19,'components with the MidString'
  311. WriteAt     43,20,'command.'
  312. Center        'Press Any Key To Continue',25
  313. ReadKey     CharIn
  314. Clear
  315. Box1        1,1,39,11,116
  316. WriteAt     16,1,' Concat '
  317. Box1        41,1,80,11,116
  318. WriteAt     56,1,' Length '
  319. Box1        1,13,39,24,116
  320. WriteAt     16,13,' Lower '
  321. Box1        41,13,80,24,116
  322. WriteAt     56,13,' Upper '
  323.                 ;         1      1    2    2     3      3    4    4     5      5    6    6     7      7    8
  324.                 ;...5....0....5....0....5....0....5....0....5....0....5....0....5....0....5....0
  325. WriteAt     2,3,'The Concat command is used to combine'
  326. WriteAt     2,4,'two variables (or combinations of'
  327. WriteAt     2,5,'variables and constants) into one'
  328. WriteAt     2,6,'variable.'
  329. WriteAt     2,7,'  Concat Msg,DrIn,ErrMsg6'
  330. WriteAt     2,8,'would combine the contents of DrIn'
  331. WriteAt     2,9,'and ErrMsg6 into the variable Msg.'
  332. WriteAt     42,3,'The Length command will calculate'
  333. WriteAt     42,4,'the length of any variable. This'
  334. WriteAt     42,5,'length is valuable when using the'
  335. WriteAt     43,6,'MidString command.'
  336.                 ;         1      1    2    2     3      3    4    4     5      5    6    6     7      7    8
  337.                 ;...5....0....5....0....5....0....5....0....5....0....5....0....5....0....5....0
  338. WriteAt     2,14,'The Lower command will change any'
  339. WriteAt     2,15,'upper case characters to lower'
  340. WriteAt     2,16,'case. Any characters which are not'
  341. WriteAt     2,17,'alphabetic characters will remain'
  342. WriteAt     2,18,'unchanged.'
  343. WriteAt     42,14,'The Upper command will change any'
  344. WriteAt     42,15,'lower case characters to upper'
  345. WriteAt     42,16,'case. Any characters which are not'
  346. WriteAt     42,17,'alphabetic characters will remain'
  347. WriteAt     42,18,'unchanged.'
  348. Center        'Press Any Key To Continue',25
  349. ReadKey     CharIn
  350. GoTo        ColorMon
  351. Label       WritInfo
  352. Box2        5,5,76,20,116
  353. WriteAt     7,7,'PowerBatch contains a number of screen writing commands, all designed'
  354. WriteAt     7,8,'to get the information to the screen as quickly as possible. One of'
  355. WriteAt     7,9,'the major deficiencies of the DOS batch file is the slow screen write'
  356. WriteAt     7,10,'functions associated with DOS. To get a feel for the speed at which'
  357. WriteAt     7,11,'PowerBatch writes to the screen, press any key to redisplay this'
  358. WriteAt     7,12,'entire screen. I will clear the screen, draw the box, center the'
  359. WriteAt     7,13,'title, and rewrite all the text. Ready when you are...'
  360. ReadKey     CharIn
  361. Clear
  362. Box2        5,5,76,20,116
  363. Center        ' PowerBatch Screen Write Functions ',5
  364. WriteAt     7,7,'PowerBatch contains a number of screen writing commands, all designed'
  365. WriteAt     7,8,'to get the information to the screen as quickly as possible. One of'
  366. WriteAt     7,9,'the major deficiencies of the DOS batch file is the slow screen write'
  367. WriteAt     7,10,'functions associated with DOS. To get a feel for the speed at which'
  368. WriteAt     7,11,'PowerBatch writes to the screen, press any key to redisplay this'
  369. WriteAt     7,12,'entire screen. I will clear the screen, draw the box, center the'
  370. WriteAt     7,13,'title, and rewrite all the text. Were you impressed...'
  371. Wait        50
  372. ClearBox    5,5,76,20,116
  373. WriteAt     7,7,'PowerBatch provides 4 screen writing commands: 1) WriteAT, 2) Write,'
  374. WriteAt     7,8,'3) WriteLine, and 4) Center. Lets look at the differences in these'
  375. WriteAt     7,9,'commands. Center is the most obvious. If you want to center a line'
  376. WriteAt     7,10,'of text, use this command. It was used to center the title on this'
  377. WriteAt     7,11,'box and the message at the bottom.'
  378. Center        ' Press Any Key To Continue ',20
  379. ReadKey     CharIn
  380. ClearBox    5,5,76,20,116
  381. WriteAt     7,7,'WriteAt has the syntax'
  382. WriteAt     12,8,'WriteAT  Col,Row,Text To Be Written'
  383. WriteAt     7,9,'It allows you to position text anywhere on the screen with direct'
  384. WriteAt     7,10,'screen co-ordinates.'
  385. WriteAt     7,12,'Write has the syntax'
  386. WriteAt     12,13,'Write  Text To Be Written'
  387. WriteAt     7,14,'Text is written beginning with the current cursor location. It can'
  388. WriteAt     7,15,'be thought of as on screen concatenation.'
  389. WriteAt     7,17,'WriteLine has the syntax'
  390. WriteAt     12,18,'WriteLine  Row,Text To Be Written'
  391. WriteAt     7,19,'The text is written on the specified Row beginning in column 1.'
  392. ReadKey     CharIn
  393. GoTo        ColorMon
  394. Label       MiscInfo
  395. Box2        1,1,80,25,116
  396. Center        ' Miscellaneous Functions ',1
  397. Center        EscMsg,25
  398.                 ;        1     1      2    2    3     3      4    4    5     5      6    6    7     7      8
  399.                 ;..5....0....5....0....5....0....5....0....5....0....5....0....5....0....5....0
  400. WriteAt     3,3,'ADD       Provides the ability to increment a counter. Useful for looping'
  401. WriteAT     3,4,'           through a routine X times as well as arithmatic.'
  402. WriteAT     3,5,'BEEP      Complete control over the system speaker. Sound the speaker at a'
  403. WriteAT     3,6,'           specified frequency for any length of time and repeat N times.'
  404. WriteAT     3,7,'BLINK     Will cause all following write statements to be written with the'
  405. WriteAT     3,8,'           current color attribute but with the'
  406. Blink
  407. WriteAT     51,8,'blink'
  408. Normal
  409. WriteAT     57,8,'bit on. NORMAL resets.'
  410.                 ;        1     1      2    2    3     3      4    4    5     5      6    6    7     7      8
  411.                 ;..5....0....5....0....5....0....5....0....5....0....5....0....5....0....5....0
  412. WriteAT     3,9,'CENTER    Used to center text on the screen. The title of this screen was'
  413. WriteAT     3,10,'          centered after the box was drawn.'
  414. WriteAt     3,11,'CONCAT    Provides a means to combine two text strings into one. Use this'
  415. WriteAT     3,12,'           command to build messages prior to writing to the screen.'
  416. WriteAt     20,13,'Variable  Err1,25, is an invalid drive!'
  417. WriteAt     20,14,'Concat    Msg1, DriveInput, Err1'
  418. WriteAt     20,15,'WriteAt   2,25,Msg1'
  419. WriteAt     3,16,'LENGTH    Calculates the length of a string. Use in conjunction with the'
  420. WriteAt     3,17,'           MIDSTRING command or for editing of input data.'
  421. WriteAt     3,18,'LOWER     Changes all alphabetic characters in a string to lower case without'
  422. WriteAt     3,19,'           having any effect on non-alphabetic characters in the string.'
  423. WriteAt     3,20,'REVERSE   Will cause all write statements that follow to be written in'
  424. Reverse
  425. WriteAt     14,21,'reverse'
  426. Normal
  427. WriteAt     22,21,'video. Use NORMAL to reset the color to the prior value.'
  428. WriteAt     3,22,'SUBTRACT  Provides the ability to decrement a counter.'
  429. WriteAt     3,23,'UPPER    Changes all alphabetic characters in a string to upper case without'
  430. WriteAt     3,24,'          having any effect on non-alphabetic characters in the string.'
  431. ReadKey     CharIn
  432. GoTo        ColorMon
  433. Label       Finis
  434. Clear
  435. Color           ColorAttr                       ;reset original colors
  436. Clear
  437. Box3            24,1,56,5,ColorAttr
  438. Center          "POWERBATCH",2
  439. Center          "By",3
  440. Center          "Computing Systems Design, Inc.",4
  441. GoToXy          1,24
  442. Cursor            1
  443.